import { defHttp } from '/@/utils/http/axios';
import { AuthParamsModel, ActionParamsModel } from './model/authModel';

enum Api {
  AddModuleAuth = '/admin/moduleusertype/add',
  UpdateModuleAuth = '/admin/moduleusertype/update',
  DelModuleAuth = '/admin/moduleusertype/del',
  USINGHANDLEDEF_AUTH = '/admin/usinghandledef/add',
  Update_USINGHANDLEDEF_AUTH = '/admin/usinghandledef/update',
  Del_USINGHANDLEDEF_AUTH = '/admin/usinghandledef/del',
  GET_USINGHANDLEDEF_AUTH = '/admin/usinghandledef',
  GET_CUSTOMPAGE_BTNAUTH = '/admin/usinghandledef/getAuthByModuleId',
}

export const addModuleAuthApi = (params: AuthParamsModel) =>
  defHttp.post<boolean>({ url: Api.AddModuleAuth, params });

export const updateModuleAuthApi = (params: AuthParamsModel) =>
  defHttp.post<boolean>({ url: Api.UpdateModuleAuth, params });

export const deleteModuleAuthApi = (moduleId: number, userFlag: number) =>
  defHttp.post<boolean>({ url: Api.DelModuleAuth + '/' + moduleId + '/' + userFlag });

export const delUsinghandledefAuthApi = (handleId: number) =>
  defHttp.post<boolean>({ url: Api.Del_USINGHANDLEDEF_AUTH + '/' + handleId });

export const addUsinghandledefAuthApi = (params: ActionParamsModel) =>
  defHttp.post<any>({ url: Api.USINGHANDLEDEF_AUTH, params });

export const updateUsinghandledefAuthApi = (params: ActionParamsModel) =>
  defHttp.post<any>({ url: Api.Update_USINGHANDLEDEF_AUTH, params });

export const UsinghandledefAuthInfoApi = (handleId: number) =>
  defHttp.get<any>({ url: Api.GET_USINGHANDLEDEF_AUTH + '/' + handleId });

export const GetCustomPageBtnAuth = (moduleId: string) =>
  defHttp.get<any>({ url: Api.GET_CUSTOMPAGE_BTNAUTH + '/' + moduleId });
